package com.polaris.live.net.service

import com.polaris.live.common.network.ApiResponse
import com.polaris.live.im.sfs.bean.live.ext.UserBasicVo
import com.polaris.live.resp.back_resp.BanMessageResp
import com.polaris.live.resp.back_resp.CallCheckResp
import com.polaris.live.resp.back_resp.CallConnectResp
import com.polaris.live.resp.back_resp.CallGameReadyResp
import com.polaris.live.resp.back_resp.CallLabelRespItem
import com.polaris.live.resp.back_resp.CallStartResp
import com.polaris.live.resp.back_resp.CallVo
import com.polaris.live.resp.back_resp.JoinConditionResp
import com.polaris.live.resp.back_resp.LiveAdministratorResp
import com.polaris.live.resp.back_resp.LiveConsumeUserResp
import com.polaris.live.resp.back_resp.LiveConsumptionUserVo
import com.polaris.live.resp.back_resp.LiveEmojiResp
import com.polaris.live.resp.back_resp.LiveInviteJoinUserResp
import com.polaris.live.resp.back_resp.LiveModifyPriceResp
import com.polaris.live.resp.back_resp.LivePasswordResp
import com.polaris.live.resp.back_resp.LiveRemindResp
import com.polaris.live.resp.back_resp.LiveResourceConfigResp
import com.polaris.live.resp.back_resp.LiveRoomBannerResp
import com.polaris.live.resp.back_resp.LiveRoomUserResp
import com.polaris.live.resp.back_resp.LiveStartGameResp
import com.polaris.live.resp.back_resp.LiveSubsidyIndicatorResp
import com.polaris.live.resp.back_resp.LiveUserOnlineResp
import com.polaris.live.resp.back_resp.LiveWelcomeResp
import com.polaris.live.resp.back_resp.LiveWelcomeSpeechResp
import com.polaris.live.resp.back_resp.PartyGameCoinExchangePriceResp
import com.polaris.live.resp.back_resp.PartyGameResp
import com.polaris.live.resp.back_resp.PartyGameSettlementResp
import com.polaris.live.resp.back_resp.PartyGameValidCodeResp
import com.polaris.live.resp.back_resp.PartyGamingResp
import com.polaris.live.resp.back_resp.PartyMemberResp
import com.polaris.live.resp.back_resp.PartyRecentlyMemberResp
import com.polaris.live.resp.back_resp.PartyRoomInfoResp
import com.polaris.live.resp.back_resp.PartyRoomPriceResp
import com.polaris.live.resp.back_resp.PartyRoomResp
import com.polaris.live.resp.back_resp.PartyThemeResp
import com.polaris.live.resp.back_resp.RejectSiteResp
import com.polaris.live.resp.back_resp.RtcTokenResp
import com.polaris.live.resp.back_resp.StreamSwitchResp
import com.polaris.live.resp.base.ListResp
import com.polaris.live.resp.bean.SendEmojiBean
import com.polaris.live.resp.bean.ZegoGameEventBean
import com.polaris.live.resp.go_resp.CallAnswerBean
import com.polaris.live.resp.go_resp.CallEndBean
import com.polaris.live.resp.go_resp.CallIdBean
import com.polaris.live.resp.go_resp.CallStartBean
import com.polaris.live.resp.go_resp.ChangeRoomNameRequest
import com.polaris.live.resp.go_resp.FacesDetectBean
import com.polaris.live.resp.go_resp.FollowRoomRequest
import com.polaris.live.resp.go_resp.GameCoinBean
import com.polaris.live.resp.go_resp.InviteJoinPrepareRequest
import com.polaris.live.resp.go_resp.InviteJoinRequest
import com.polaris.live.resp.go_resp.InviteSiteBean
import com.polaris.live.resp.go_resp.JoinConditionRequest
import com.polaris.live.resp.go_resp.JoinMemberRequest
import com.polaris.live.resp.go_resp.LiveFollowBean
import com.polaris.live.resp.go_resp.LiveIdBean
import com.polaris.live.resp.go_resp.LiveInciteJoinPrepareResp
import com.polaris.live.resp.go_resp.SaveCallLabelBean
import com.polaris.live.resp.go_resp.ScreenshotLoadBean
import com.polaris.live.resp.go_resp.SendGiftBean
import com.polaris.live.resp.go_resp.SendPartyGiftBean
import com.polaris.live.resp.go_resp.SwimultaneousBean
import com.polaris.live.resp.go_resp.UpdateMemberRequest
import com.polaris.live.resp.go_resp.UserIdBean
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 * 直播服务
 *
 * @author Created by 半仙 on 2023/9/5/005 18:34
 */
interface LiveService {

    /**
     * 获取zego token
     */
    @GET("rtc/token")
    suspend fun getRtcToken(): ApiResponse<RtcTokenResp>

    /**
     * 拨打
     */
    @POST("call/start")
    suspend fun callStart(@Body callStartBean: CallStartBean): ApiResponse<CallStartResp>

    /**
     * 应答
     */
    @POST("call/answer")
    suspend fun callAnswer(@Body callAnswerBean: CallAnswerBean): ApiResponse<CallStartResp>

    /**
     * 通话连接
     */
    @POST("call/connect")
    suspend fun callConnect(@Body callConnectBean: CallIdBean): ApiResponse<CallConnectResp>

    /**
     * 心跳   通话心跳
     */
    @POST("call/check")
    suspend fun callCheck(@Body callCheck: CallIdBean): ApiResponse<CallCheckResp>

    /**
     * 心跳    直播心跳
     */
    @POST("live/heartbeat")
    suspend fun liveCheck(@Body liveIdBean: LiveIdBean): ApiResponse<Any>

    /**
     * 通话结束
     */
    @POST("call/end")
    suspend fun callEnd(@Body callEnd: CallEndBean): ApiResponse<CallVo>

    /**
     * 获取通话印象
     */
    @GET("call/label")
    suspend fun getCallLabel(@Query("callId") callId: Long): ApiResponse<List<CallLabelRespItem>>

    /**
     * 保存通话印象
     */
    @POST("call/label")
    suspend fun saveCallLabel(@Body saveCallLabelBean: SaveCallLabelBean): ApiResponse<Any>

    /**
     * 获取直播顶部消费列表
     */
    @GET("live/v2/consume-user")
    suspend fun liveConsumeV2(@Query("liveId") liveId: Long): ApiResponse<LiveConsumeUserResp>

    /**
     * 获取直播顶部消费列表
     */
    @GET("live/consume-user")
    suspend fun liveConsume(@Query("liveId") liveId: Long): ApiResponse<List<LiveConsumptionUserVo>>

    /**
     * 结束直播状态
     */
    @DELETE("live/end-state")
    suspend fun liveEndState(): ApiResponse<Any>

    /**
     * 结束游戏座位状态
     */
    @DELETE("party-game/site/end-state")
    suspend fun partyGameSiteEnd(): ApiResponse<Any>

    /**
     * 结束游戏状态
     */
    @DELETE("party-game/end-state")
    suspend fun partyGameEnd(): ApiResponse<Any>

    /**
     * 结束通话状态
     */
    @DELETE("call/end-state")
    suspend fun callEndState(): ApiResponse<Any>

    /**
     * 送礼物
     */
    @POST("gift/send")
    suspend fun sendGift(@Body sendGiftBean: SendGiftBean): ApiResponse<Any>

    /**
     * 截图上传
     */
    @POST("screenshot/upload")
    suspend fun screenshotUpLoad(@Body screenshotLoadBean: ScreenshotLoadBean): ApiResponse<Any>

    /**
     * 补偿开始
     */
    @POST("call/compensation-start")
    suspend fun compensationStart(@Body callStartBean: CallStartBean): ApiResponse<CallStartResp>

    /**
     * 直播人脸截图上传
     */
    @POST("faces/detect")
    suspend fun faceDetect(@Body facesDetectBean: FacesDetectBean): ApiResponse<Any>

    /**
     * 本场同声传译
     */
    @POST("call/simultaneous")
    suspend fun simultaneoutsOpen(@Body swimultaneousBean: SwimultaneousBean): ApiResponse<Any>

    /**
     * 直播关注
     */
    @POST("live/follow")
    suspend fun liveFollow(@Body liveFollowBean: LiveFollowBean): ApiResponse<Any>

    /**
     * 直播补贴指标
     */
    @GET("subsidies/subsidy")
    suspend fun subsidies(): ApiResponse<LiveSubsidyIndicatorResp>

    /**
     * 直播资源配置
     */
    @GET("app/resource")
    suspend fun getLiveResource(): ApiResponse<LiveResourceConfigResp>

    /**
     * 邀请上麦位
     */
    @POST("live/invite-site")
    suspend fun partyInviteSite(@Body inviteSiteBean: InviteSiteBean): ApiResponse<Any>

    /**
     * 拒绝上麦邀请
     */
    @POST("live/invite-site/reject")
    suspend fun partyRejectSite(@Body rejectSiteResp: RejectSiteResp): ApiResponse<Any>

    /**
     * 邀请上麦位用户列表
     */
    @GET("live/invite-site/user")
    suspend fun partyInvitationList(@Query("liveId") liveId: Long): ApiResponse<List<UserBasicVo>>

    /**
     * 获取语聊房密码
     */
    @GET("live/edit/password")
    suspend fun getPassword(): ApiResponse<LivePasswordResp>

    /**
     * 设置语聊房密码
     */
    @POST("live/edit/password")
    suspend fun setPassword(@Body livePasswordResp: LivePasswordResp): ApiResponse<LivePasswordResp>

    /**
     * 删除语聊房密码
     */
    @DELETE("live/edit/password")
    suspend fun deletePassword(): ApiResponse<Any>

    /**
     * 公屏禁言
     */
    @POST("live/ban-message")
    suspend fun banMessage(@Body banMessageResp: BanMessageResp): ApiResponse<BanMessageResp>

    /**
     * 在线用户
     */
    @GET("live/online-user")
    suspend fun getOnlineUser(@Query("liveId") liveId: Long): ApiResponse<LiveUserOnlineResp>

    /**
     * 批量送礼接口
     */
    @POST("gift/batch-send")
    suspend fun batchSend(@Body sendPartyGiftBean: SendPartyGiftBean): ApiResponse<Any>

    /**
     * 获取欢迎语
     */
    @GET("welcome-speech")
    suspend fun welcomeSpeech(): ApiResponse<LiveWelcomeSpeechResp>

    /**
     * 设置欢迎语
     */
    @POST("welcome-speech")
    suspend fun welcomeSpeechUpdate(@Body liveWelcomeResp: LiveWelcomeResp): ApiResponse<LiveWelcomeSpeechResp>

    /**
     * 游戏开始
     */
    @POST("party-game/business/start")
    suspend fun partyGameStart(@Body liveStartGameResp: LiveStartGameResp): ApiResponse<Any>

    /**
     * 修改派对游戏价格
     */
    @POST("party-game/price")
    suspend fun partyGamePrice(@Body liveModifyPriceResp: LiveModifyPriceResp): ApiResponse<Any>

    /**
     *
     * 获取结算结果
     */
    @GET("party-game/settlement-result")
    suspend fun partyGameResult(@Query("liveId") liveId: Long): ApiResponse<List<PartyGameSettlementResp>>

    /**
     * 获取单个派对游戏
     */
    @GET("party-game/game")
    suspend fun getOnePartyGame(@Query("gameId") gameId: Int): ApiResponse<PartyGameResp>

    /**
     * 获取派对游戏
     */
    @GET("party-game/games")
    suspend fun getPartyGame(): ApiResponse<List<PartyGameResp>>

    /**
     * 兑换游戏币价格列表
     */
    @GET("party-game/coin/price")
    suspend fun getPartyGameCoin(): ApiResponse<PartyGameCoinExchangePriceResp>

    /**
     * 兑换游戏币 返回用户资产详情
     */
    @POST("party-game/coin/exchange")
    suspend fun gameCoinExchange(@Body gameCoinBean: GameCoinBean): ApiResponse<Any>

    /**
     * 上报
     */
    @POST("party-game/business/zego-game/event")
    suspend fun zegoGameEvent(@Body bean: ZegoGameEventBean): ApiResponse<Any>

    /**
     * 上报
     */
    @POST("party-game/business/game/event")
    suspend fun baiShunGameEvent(@Body bean: ZegoGameEventBean): ApiResponse<Any>

    /**
     * 获取emoji列表
     */
    @GET("live/edit/emoji")
    suspend fun liveEmoji(): ApiResponse<List<LiveEmojiResp>>

    /**
     * 发送Emoji
     */
    @POST("live/edit/emoji")
    suspend fun sendEmoji(@Body sendEmojiBEean: SendEmojiBean): ApiResponse<Any>

    /**
     * 获取游戏状态
     */
    @GET("party-game/gaming")
    suspend fun partyGameGaming(): ApiResponse<PartyGamingResp>

    /**
     * 游戏准备或取消准备
     */
    @POST("party-game/business/ready")
    suspend fun callGameReady(@Body callReadyBean: CallGameReadyResp): ApiResponse<Any>

    /**
     * 通话-开关视频流
     */
    @POST("call/stream-switch")
    suspend fun streamSwitch(@Body streamSwitchResp: StreamSwitchResp): ApiResponse<Any>

    /**
     * 获取通话拒绝清单分页
     */
    @GET("call/reject-list")
    suspend fun rejectList(
        @Query("pageNumber") pageNumber: Int,
        @Query("pageSize") pageSize: Int,
    ): ApiResponse<ListResp<UserBasicVo>>

    /**
     * 加入通话拒绝清单
     */
    @POST("call/reject-list")
    suspend fun addRejectList(@Body userIdBean: UserIdBean): ApiResponse<Any>

    /**
     * 移出通话拒绝清单
     */
    @DELETE("call/reject-list")
    suspend fun rmRejectList(@Query("otherUserId") otherUserId: Long): ApiResponse<Any>

    /**
     * 索要礼物
     */
    @POST("call/invite-gift")
    suspend fun inviteGift(@Body callIdBean: CallIdBean): ApiResponse<Any>

    /**
     * 保存管理员
     */
    @POST("administrator/save")
    suspend fun administratorSave(@Body userIdBean: UserIdBean): ApiResponse<Any>

    /**
     * 删除管理员
     */
    @DELETE("administrator/remove")//TODO 后续删掉bitwise
    suspend fun administratorRemove(
        @Query("userId") userId: Long,
    ): ApiResponse<Any>

    /**
     * 获取管理员
     */
    @GET("administrator")
    suspend fun getAdministratorList(): ApiResponse<LiveAdministratorResp>

    /**
     * 获取游戏额外信息
     */
    @GET("party-game/business/ext")
    suspend fun getBaiShunGameCodeAndExt(@Query("gameId") gameId: Int): ApiResponse<PartyGameValidCodeResp>

    /**
     * 获取游戏状态
     */
    @GET("party-game/gaming")
    suspend fun partyGameing(): ApiResponse<PartyGamingResp>

    /**
     * /live/remind  底部提醒  派对开播底部提示 特权文字
     */
    @GET("live/remind")
    suspend fun partyRemind(): ApiResponse<List<LiveRemindResp>>

    /**
     * 房间Banner
     */
    @GET("live/banner")
    suspend fun getRoomBanner(@Query("liveId") liveId: Long): ApiResponse<List<LiveRoomBannerResp>>

    /**
     * 获取派对主题
     */
    @GET("party/theme")
    suspend fun getPartyTheme(): ApiResponse<MutableList<PartyThemeResp>>

    /**
     * 获取房间信息
     */
    @GET("party/room")
    suspend fun getPartyRoom(): ApiResponse<PartyRoomResp>

    /**
     * 修改/保存房间名称
     */
    @POST("party/room/name")
    suspend fun changeRoomName(@Body changeRoomNameRequest: ChangeRoomNameRequest): ApiResponse<Any>

    /**
     * 获取房间信息-房间内使用
     */
    @GET("party/room/info")
    suspend fun getPartyRoomInfo(@Query("liveId") liveId: Long): ApiResponse<PartyRoomInfoResp>

    /**
     * 获取房间的粉丝列表
     */
    @GET("fans")
    suspend fun getPartyRoomFans(
        @Query("otherUserId") otherUserId: Long,
        @Query("pageNumber") pageNumber: Int,
        @Query("pageSize") pageSize: Int,
    ): ApiResponse<ListResp<UserBasicVo>>

    /**
     * 房间用户
     */
    @GET("live/room-user")
    suspend fun getRoomUser(
        @Query("liveId") liveId: Long,
        @Query("pageNumber") pageNumber: Int,
        @Query("pageSize") pageSize: Int,
    ): ApiResponse<LiveRoomUserResp>

    /**
     * 关注房间
     */
    @POST("follow")
    suspend fun followRoom(@Body followRoomRequest: FollowRoomRequest): ApiResponse<Any>

    /**
     * 取消关注
     */
    @DELETE("follow")
    suspend fun unFollowRoom(@Query("otherUserId") otherUserId: Long): ApiResponse<Any>

    /**
     * 是否关注
     */
    @GET("isFollow")
    suspend fun isFollowRoom(@Query("otherUserId") otherUserId: Long): ApiResponse<Boolean>

    /**
     * 获取房间成员价格
     */
    @GET("party/members/price")
    suspend fun membersPrice(): ApiResponse<PartyRoomPriceResp>

    /**
     * 更新房间成员价格
     */
    @POST("party/members/price")
    suspend fun upDateMembersPrice(@Body updateMemberRequest: UpdateMemberRequest): ApiResponse<PartyRoomPriceResp>

    /**
     * 加入成员
     */
    @POST("party/members/join")
    suspend fun joinMembers(@Body joineMemberRequest: JoinMemberRequest): ApiResponse<Any>


    /**
     * 获取成员汇总
     */
    @GET("party/members/summary")
    suspend fun membersSummary(@Query("roomId") roomId: String): ApiResponse<PartyMemberResp>

    /**
     * 获取最近成为的成员
     */
    @GET("party/members/recently")
    suspend fun membersRecently(
        @Query("roomId") roomId: String,
        @Query("pageNumber") pageNumber: Long,
        @Query("pageSize") pageSize: Long,
    ): ApiResponse<ListResp<PartyRecentlyMemberResp>>

    /**
     * 获取成员
     */
    @GET("party/members/page")
    suspend fun membersPage(
        @Query("roomId") roomId: String,
        @Query("pageNumber") pageNumber: Long,
        @Query("pageSize") pageSize: Long,
    ): ApiResponse<ListResp<UserBasicVo>>

    /**
     * 是否成员
     */
    @GET("party/members/is-member")
    suspend fun isMembers(
        @Query("roomId") roomId: String,
    ): ApiResponse<Boolean>


    /**
     * 退出成员
     */
    @DELETE("party/members/quit")
    suspend fun membersQuit(
        @Query("roomId") roomId: String,
    ): ApiResponse<Any>

    /**
     * 踢出成员
     */
    @DELETE("party/members/kick")
    suspend fun kickMembers(
        @Query("roomId") roomId: String,
        @Query("userId") userId: Long,
    ): ApiResponse<Any>

    /**
     * 更新房间加入条件
     */
    @POST("party/room/join-condition")
    suspend fun joinCondition(@Body joinConditionRequest: JoinConditionRequest): ApiResponse<Any>

    /**
     * 获取房间加入条件
     */
    @GET("party/room/join-condition")
    suspend fun getJoinCondition(
        @Query("roomId") roomId: String,
    ): ApiResponse<JoinConditionResp>

    /**
     * 可邀请邀请用户
     */
    @GET("invite/user")
    suspend fun getInviteUser(
        @Query("liveId") liveId: Long,
        @Query("searchText") searchText: String?,
        @Query("pageNumber") pageNumber: Int,
        @Query("pageSize") pageSize: Int,
    ): ApiResponse<ListResp<LiveInviteJoinUserResp>>

    /**
     * 邀请加入
     */
    @POST("invite/join")
    suspend fun inviteJoin(@Body inviteJoinRequest: InviteJoinRequest): ApiResponse<Any>

    /**
     * 邀请加入 加入预检查
     */
    @POST("invite/join-prepare")
    suspend fun inviteJoinPrepare(@Body inviteJoinPrepareRequest: InviteJoinPrepareRequest): ApiResponse<LiveInciteJoinPrepareResp>
}

